from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save


# Create your models here.
STATUS_CHOICES = (
    ('ACTIVE', 'ACTIVE'),
    ('INACTIVE', 'INACTIVE'),)
EXCHANGE_CHOICES=(
('INBOX','INBOX'),('OUTBOX','OUTBOX'),('DRAFT','DRAFT'),
)    


class mail(models.Model):
    mail_to=models.ForeignKey(User,null=True,blank=True,related_name="mail_to")
    mail_from=models.ForeignKey(User,null=True,blank=True,related_name="mail_from")
    #mail_cc=models.EmailField(max_length=150,null=True,blank=True)
    #mail_bcc=models.EmailField(max_length=150,null=True,blank=True)
    #public_key=models.TextField()
    #private_key=models.TextField()
    mail_onrecord=models.BooleanField(default=False)
    mail_offrecord=models.BooleanField(default=False)
    mail_subject=models.CharField(max_length=150,null=False,blank=False)
    mail_details=models.TextField(null=False,blank=False)
    mail_sent_date=models.DateField(auto_now_add=True)
    mail_status_inbox=models.CharField(max_length=150,null=False,choices=STATUS_CHOICES,default='ACTIVE')
    mail_status_outbox=models.CharField(max_length=150,null=False,choices=STATUS_CHOICES,default='ACTIVE')
    #mail_priority=models.IntegerField(null=True,blank=True)
    mail_read_date=models.DateField(null=True,blank=True)
    is_read=models.BooleanField(default=False)
    is_agreed=models.BooleanField(default=False)
    #mail_folder_id=models.IntegerField(null=True,blank=True)
    #mail_exchange_to_sender=models.CharField(max_length=10,choices=EXCHANGE_CHOICES,default='OUTBOX')
    #mail_exchange_to_receiver=models.CharField(null=True,max_length=10,choices=EXCHANGE_CHOICES,default='INBOX')
    
    def __str__(self):
        return self.id